<?php
include("model/employees.php");
class loginController{
	function indexAction()
	{
		$smarty = $_SESSION['smarty'];
		
		$content = $smarty->fetch("login.html");		
		$smarty->assign("content", $content);
		
		$smarty->display("homepage.html");
	}
	
	function checkLoginAction(){
		$username = $_REQUEST['username'];
		$password = $_REQUEST['password'];
		$employees = new employees();
		$employee_info = array();
		$employee_info = $employees->checkAuthentication($username, $password);
		
		if ($employee_info!=false)
		{
			
			session_start();
			$_SESSION['employee'] = $employee_info;	
			header('Location: '.APPLICATION_URL);
		}
		else 
		{
			header('Location: '.APPLICATION_URL."login/");
		}
	}
}
?>